title: Why can't I access a protected member variable of a base class passed into a function as an argument?
body: <p><a href="https://stackoverflow.com/a/967363/15369">This</a> answer seems to suggest it should work so why does my example kick up a compiler error:</p>
  
  <pre><code>class Class1
  {
  protected:
      long m_memberVar;
  };
  
  class SubClass1: public Class1
  {
  public:
      void PrintMember(Class1 memberToPrintFrom)
      {
          Console::Write("{0}", memberToPrintFrom.m_memberVar); // &lt;-- Compiler error: error C2248: 'BaseClassMemberAccess::Class1::m_memberVar' : cannot access protected member declared in class 'BaseClassMemberAccess::Class1'
      }
  };
  </code></pre>
  
  <p><em>[Edit] - changed subclass to a public inheritance on Need4Sleep's suggestion but it makes no difference.</em></p>