You are wondering about a variable outside of a class. I will explain this the none-C++ way. Let's look at it from the paradigm of general machine architecture and the way programming languages are oft defined. The issue is stack frames, the concept of the stack, and how program refer to memory locations.
When a function is called, the variables of that function are pushed onto the stack. A function and its variables are often a sequence of memory locations. When the function is finished, it and those variables are popped off the stack. That means when the function is called, variables come into existence. When the function is done, the variables depart immediately. Each variable, like the function itself are memory locations (may be assigned to registers).
Declaring the class does not declare a variable. The class is just a definition in the world of C++ and has no linkage to the variable defined in the outer scope. The phrase, automatic storage duration, is roughly synonymous with the idea of the variable (memory) automatically recovered when the function exits. Even though it is C++, when it compiles, it is still machine language and will obey the rules of the machine. The method you called on the class is part of the class but is not part of the function. Only the class definition is local to the function.
All functions, regardless of where they exist are their own stack frame. The standard way stack frames are done means, unless the memory location referenced is valid, the data will be inaccessible by the time the function in the class is called. In this case, it isn't because the variable in the outer scope has been reclaimed, but because when the method in the class is called, the stack frame in which the outer variable exists is not active in the series of registers used by the method being called. The compiler was encoded with the understanding of this process and gave an error message to ward off the trouble that would ensue if such access was attempted.
You can still access the variable if you affix the static keyword to the variable. That is mentioned in the web page Local Classes in C++ that has the same code example you have listed. Basically, you have to extend the storage duration or the duration that the memory for the variable remains valid in the enclosing scope. Generally, a good way to think through these kind of error messages is through knowledge of the language specification, but in terms of time, relating the representations back to machine architecture can zero in on the underlying reasons why.
あなたの質問はありますか? – Jarod42