title: Access to private member data of outer class in inner class
body: <p>There is this code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  class Outer{
      int a; // private data member of class Outer
  public:
      Outer(): a(55){}
      class Inner{
      public:
          void fun(Outer ob){
              std::cout &lt;&lt; ob.a &lt;&lt; std::endl;
          }
      };
  };
  
  int main() {
  
      Outer::Inner object;
      object.fun(Outer()); // prints 55
      //std::cout &lt;&lt; (Outer().a) &lt;&lt; std::endl; error: 'int Outer::a' is private
  
      return 0;
  } 
  </code></pre>
  
  <p>Why Inner class has access to private member data 'a' of class Outer? Following this article <a href="http://publib.boulder.ibm.com/infocenter/lnxpcomp/v8v101/index.jsp?topic=/com.ibm.xlcpp8l.doc/language/ref/cplr061.htm" rel="noreferrer">XL C/C++ V8.0 for Linux</a>, it should not compile, however it compiles on g++ 4.4.0.</p>