title: Why can I use auto on a private type?
body: <p>I was somehow surprised that the following code compiles and runs (vc2012 &amp; gcc4.7.2)</p>
  
  <pre><code>class Foo {
      struct Bar { int i; };
  public:
      Bar Baz() { return Bar(); }
  };
  
  int main() {
      Foo f;
      // Foo::Bar b = f.Baz();  // error
      auto b = f.Baz();         // ok
      std::cout &lt;&lt; b.i;
  }
  </code></pre>
  
  <p>Is it correct that this code compiles fine? And why is it correct? Why can I use <code>auto</code> on a private type, while I can't use its name (as expected)?</p>