title: Object of derived class inherited privately cannot access base class member function
body: <pre><code>#include &lt;iostream&gt;
  using namespace std;
  class B
  {
    public:
    int x;
    void print()
    {
      cout&lt;&lt;x;
    }
  };
  
  class D:private B
  {
  };
  
  int main()
  {
    D d;
    d.print();
  }
  </code></pre>
  
  <p>Why can't I access print method ? Print method from <code>B</code> will be private property of <code>D</code> so it's logical that I should access it using object of <code>D</code>.
  The error I'm getting is this:</p>
  
  <blockquote>
    <p>'B' is not an accessible base of 'D'.</p>
  </blockquote>