title: C++ boost::bind says inaccessible base class
body: <p>I am trying to use <code>boost::bind</code> to call a member function in a class.  Normally this works fine, but in this particular case my compiler (GCC) is complaining that I am trying to use an inaccessible base class when I am not.</p>
  
  <p>Here is some code that demonstrates the problem.  What am I doing wrong?</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;boost/bind.hpp&gt;
  #include &lt;boost/function.hpp&gt;
  
  class base
  {
      protected:
          void test()
          {
              std::cout &lt;&lt; "base::test()\n";
          }
  };
  
  class derived: virtual protected base
  {
      public:
          using base::test;
  };
  
  int main(void)
  {
      derived d;
  
      // This works, calling derived::test(), which in turn calls base::test()
      d.test();
  
      // This does not work, saying 'base' is an inaccessible base of 'derived',
      // but I am not binding base::test, I am binding derived::test.
      boost::function&lt;void()&gt; fn;
      fn = boost::bind(&amp;derived::test, d);
      fn();
  
      return 0;
  }
  </code></pre>