I finally found the origin of the problem, it was due to a bad use of #include
.
Removing the line #include "B.hpp"
in A.hpp solves the problem. The A header only needs a forward declaration of class B, since it uses only a pointer to this class. I conclude I had a circular header reference. I thought that using friend
requires to include the header of the class. Note: class B needs to access actually some private members of class A.
Sorry for my bad initial post, it was impossible to diagnose anything from it since it was not close enough from the real one (coorected). I will stick to SSCCE next time. Thanks everyone. As the buddy concludes here, "That was really stupid". Then I found detailed explanations here and here.