You should define a class in a header file. only the function and static data member definitions should be in a .cpp file.
You should also use compiler macros (#if defined / #define / #endif) to prevent multiple includes.
About A in B and B in A:
What you have stated would cause infinite recursion:
Each A contains a B, each of which contains and A, each of which contains a B, each of which contains an A ... and so on.
You cannot do that obviously. You can nevertheless, have for example an A-pointer int B and an instance of B in A.
I don't know what you want to achieve but you could use a constructor of B to pass in a pointer to the A object it is contained in (if this is always the case for example).
B.h
#if !defined(B_CLASS_H)
#define B_CLASS_H
class A; // forward declare A, no include "A.h" here
class B
{
A * a_pointer;
public:
B (A* another_A);
};
#endif
B.cc
#include "B.h"
B::B (A* another_A) : a_pointer(another_A) { }
A.h
#if !defined(A_CLASS_H)
#define A_CLASS_H
#include "B.h"
class A
{
B b_instance;
public:
A (void);
};
#endif
A.cc
#include "A.h"
A::A (void) : b_instance(this) { }