title: What is the size of a class when it is inherited from a class which has all its members private in c++?
body: <p>Suppose there are two classes Base and Derived</p>
  
  <pre><code>class Base
  {
    private: 
  int a;
  }
  class Derived:public Base
  {
  private:
  int b;
   }
   int main()
  {
   Derived d;
   cout&lt;&lt;sizeof(d);
    }
  </code></pre>
  
  <p>The output is 8. Now my question is when the member variable of Base class is private and derived class cannot inherit it then why does it include the data member when showing the size of the class?</p>