This code compiles in VS2010, and I believe it does for any compiler.
#include <iosfwd>
using namespace std;
class ostream;
int main() {}
The same happens with this code
#include <iosfwd>
using namespace std;
int main() { class ostream; }
But this code generates error C2872: 'ostream' : ambiguous symbol
#include <iosfwd>
using namespace std;
class ostream;
int main() { class ostream; }