Nested class member access on C++11
问题 In C++11, I am trying to access a member variable of an enclosing class from a nested class in the following way: struct Enclosing { int a; struct Nested { int f() { return a; } }; }; Even this doesn't compile using g++4.7.2 with -std=c++11, producing error messages of this form: error: invalid use of non-static data member 'Enclosing::a' As far as I understand, C++11 treats a nested class as a member of the class, so that supposedly a nested class can access every other member of the