In nestClassDef.h I have written code like this
  class A{
    public:
     class B{
         public:
           void BTest();
     };
 };
   class B{
   };
then in the nestClassDef.cpp I am writing code like this
      #include "nestClassDef.h"
      #include<iostream>
      void A::B::BTest(){
        cout<<"Hello World!";
     }
    int main(){
      A a;
      A.B b;
      b.BTest();
    } 
But when I am compiling the above code
       g++ -o nestClassDef nestClassDef.cpp
I am getting error like this :-
      nestClassDef.cpp: In member function ‘void A::B::BTest()’:
      nestClassDef.cpp:5: error: ‘cout’ was not declared in this scope
      nestClassDef.cpp: In function ‘int main()’:
      nestClassDef.cpp:10: error: expected unqualified-id before ‘.’ token
      nestClassDef.cpp:11: error: ‘b’ was not declared in this scope 
I am at a loss how to fix this. Any understanding shared will be thankfully received.
 
     
     
    