Question: This is blowing my mind. I will post code if I need to, only if the answer is "No, it shouldn't do that."

The question is simple:

**Should a class nested inside an "owning" class (for lack of a better word) be able to access the owning class's private variables via its own pointer to an instance of the owning class?**

Because that is what I am seeing; I am using 2011 version of C++. Is this expected?

Answer: 
Quoting from C++ standard N3485 `class.access.nested`:

> 
> A nested class is a member `type` and as such has the same access rights as any other member. The members of
>  an enclosing class have no special access to members of a nested class; the usual access rules (Clause 11)
>  shall be obeyed
> 
> 
> 

```
class E {
    int x;
    class B { };
    class I {
       B b; // OK: E::I can access E::B
       int y;
       void f(E* p, int i) {
          p->x = i; // OK: E::I can access E::x
       }
   };
   int g(I* p) {
      return p->y; // error: I::y is private
   }
};

```

You can find information about Clause 11 here:
[C++ Standard papers N3485](https://github.com/cplusplus/draft/blob/master/papers/N3485.pdf)(need to view the file through the link or download it)
The variables defined in the owner class, are private in its scope: i.e. Anything within that scope including the nested class can access them. If this is not your desired behavior then move the definition of the nested class outside of the owner class