You cannot create instances of an incomplete type (the compiler does not know anything about the class!)
You need to move the definitions of your functions (constructor A and B) to a C ++ file, which can include both headers (or to multiple C ++ files, if you agree that you have one class for each file).
As said, your written code has a serious problem: each A creates an instance of B and each B creates an instance of A. You end up with infinite recursion and end up running out of memory.
Two minor nitpicks: you donβt need to check if the pointer is null before calling delete on it (it is safe to delete the null pointer), and you need to change your security features (names starting with underscores in the global namespace are reserved for implementation).
source share