'incomplete type named in nested name specifier (in nested classes) C++ [duplicate]

I have those two classes that include each other like this:

//A.hpp

#include "B.hpp"

class B;

class A {
   class AException : public std::exception {
      const char *what() const throw ();
   };
   // Some other members in which I use B class
};
//B.hpp

#include "A.hpp"

class A;

class B {
   typedef A::AException AException;
   // Some other members in which I use A class
};

So I want to bring A::AException into the scope of B, so that I have B::AException == A::AException, but the typedef is throwing incomplete type named in nested name specifier at compilation. I can't figure out how to do this, is this even possible ? I tried using the typename keyword but it doesn't work since there is no template. Thanks for the help (I use C++98 standard for this project)



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source