First, I'm not sure if you actually copied and pasted, but in your A class, public; should be public: .
Second, you need semicolons after the closing brace of all of the class definitions.
The main problem is that you are defining m_b in the constructor of A (a local variable), then trying to access it from a member function of A. You need to define m_b as a member variable of A (outside of any functions, including the constructor).