title: Why does explicit typecasting allow upcasting for private inheritance?
body: <pre><code>#include&lt;iostream&gt;
  using namespace std;
  
  class A {
      public:
      void f(){cout&lt;&lt;"A"&lt;&lt;endl;}
  };
  
  class B : private A {
      public:
      void f(){cout&lt;&lt;"B"&lt;&lt;endl;}
  };
  
  int main (){
  </code></pre>
  
  <p>As Class B is inheriting Class A privately, this upcasting is not supposed to work:</p>
  
  <pre><code>    A* a = new B;
  </code></pre>
  
  <p>But explicit typecasting is allowing it.
  Why?</p>
  
  <pre><code>    A* a1 = (A*)new B;
      a1-&gt;f();
      return 0;
  }
  </code></pre>