I dont know if what I want have to be done using inheritance or simply writing correct 'friend' keyword.

I have the next code :
Qt Code:
  1. ClassA
  2. public :
  3. void methodA
  4. private :
  5. ClassB my_classb
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. ClassB
  2. void methodB
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. void ClassB::methodB
  2. {
  3. if (condition)
  4. classB.methodA ();
  5. }
To copy to clipboard, switch view to plain text mode 

As you can see I'd want to acces to a methodA from metodB.
I can do the work using inheritance, but I would not want access to all public members, only to one of them.
I have see also the friend keyword, but I dont know how to write the correct code.

I'm sure that this is easy to do, but I dont find the way.
Any help will be appreciated.