title: conversion to inaccessible base class is not allowed
body: <p>I define a class B1 and a derived class D1 at first. Then I want to define a reference to B1 and initialize that to the D1 object I just defined. Here comes the error, saying that "conversion to inaccessible base class 'B1' is not allowed", which I don't know why.</p>
  
  <pre><code>#include "std_lib_facilities.h"
  
  class B1 {
  public:
      virtual void vf() { cout &lt;&lt; "B1::vf()\n"; };
      void f() { cout &lt;&lt; "B1::f()\n"; };
  };
  
  class D1 :B1 {
  public:
      void vf() { cout &lt;&lt; "D1:vf()\n"; };
      void f() { cout &lt;&lt; "D1::f()\n"; };
  };
  
  
  
  
  int main()
  {
      B1 b1;
      b1.vf();
      b1.f();
  
      D1 d1;
      d1.vf();
      d1.f();
  
      B1&amp; db=d1;//error
  
      keep_window_open();
      return 0;
  }
  </code></pre>