An interesting simple code of forward declaration

There are 2 classes, A and B:

----------
FileA.h
----------
#include <FileB.h>
class B; //Why forward declaration here
class A{
...
B objB;
...
};
----------
FileA.cc
----------
#include <FileA.h>
...implementation of class A...

----------
FileB.h
----------
class A; // I understand this is forward declaration
class B{
...
A objA;
...
};

----------
FileB.cc
----------
...Implementation of class B

What I don't understand is that why forward declare class B in FileA.h?
Seems FileA.h already included FileB.h.
[671 byte] By [warrener] at [2007-11-20 11:59:57]
# 1 Re: An interesting simple code of forward declaration
What I don't understand is that why forward declare class B in FileA.h?
Seems FileA.h already included FileB.h.You are right - it is not needed. Nor would it help - the forward declaration allows you to declare pointer to that class, NOT an instance of it.
This code produces error:
error C2079: 'B::objA' uses undefined class 'A'in FileB.h
VladimirF at 2007-11-11 4:01:43 >
# 2 Re: An interesting simple code of forward declaration
Thanks, but why I don't get an error?
warrener at 2007-11-11 4:02:48 >
# 3 Re: An interesting simple code of forward declaration
Thanks, but why I don't get an error?Don't know... Could you post your entire solution?
VladimirF at 2007-11-11 4:03:46 >