For a code like this:
class foo { protected: int a; public: class bar { public: int getA() {return a;} // ERROR }; foo()
You try to access private member of one class from another. The fact that bar-class is declared within foo-class means that bar in visible only inside foo class, but that is still other class.
And what is p->param?
Actually, it isn't clear what do you want to do