title: Dynamic downcast on private inheritance within private scope
body: <p>A tweak on <a href="https://stackoverflow.com/questions/844816/c-style-upcast-and-downcast-involving-private-inheritance">this question</a> that I've run into. Consider:</p>
  
  <pre><code>class A {};
  
  class B : private A {
     static void foo();
  };
  
  void B::foo(){
     B* bPtr1 = new B;
     A* aPtr1 = dynamic_cast&lt;A*&gt;(bPtr1); // gives pointer
     B* bPtr2 = dynamic_cast&lt;B*&gt;(aPtr1); // gives NULL
  }
  </code></pre>
  
  <p>Since <code>aPtr1</code> is, in fact, of type <code>B*</code>, and since we've got full access to <code>B</code> and its inheritance from <code>A</code>, I'd expected both casts to work. But they don't; why? Is there another way to achieve this cast?</p>
  
  <p>Note that:</p>
  
  <ul>
  <li>If <code>foo()</code> were not a member of B, both casts would fail.</li>
  <li>If <code>B</code> inherits from <code>A</code> publicly, both casts would work.</li>
  </ul>