title: invalid use of non-static data member
body: <p>For a code like this:</p>
  
  <pre><code>class foo {
    protected:
      int a;
    public:
      class bar {
        public:
          int getA() {return a;}   // ERROR
      };
      foo()
        : a (p-&gt;param)
  };
  </code></pre>
  
  <p>I get this error:</p>
  
  <pre><code> invalid use of non-static data member 'foo::a'
  </code></pre>
  
  <p>currently the variable <code>a</code> is initialized in the constructor of <code>foo</code>.</p>
  
  <p>if I make it static, then it says:</p>
  
  <pre><code> error: 'int foo::a' is a static data member; it can only be initialized at its definition
  </code></pre>
  
  <p>However I want to pass a value to <code>a</code> in the constructor.
  What is the solution then?</p>