I have problems with Visual C++ 6.0 SP2 and NT 4.0 SP3 compiling this code:

#include <string>
using namespace std;
class Test
{
friend bool operator==( const Test& lhs, const Test& rhs );
private:
string s;
};
bool operator==( const Test& lhs, const Test& rhs )
{ return ( lhs.s == rhs.s ); }



I always receive a C2248-compiler-error. This is strange because I can compile it without any problems with VC 5.0 on NT or egcs on Linux.

Another strange thing: I can compile the inline-version

#include <string>
using namespace std;
class Test
{
friend bool operator==( const Test& lhs, const Test& rhs )
{ return ( lhs.s == rhs.s ); }
private:
string s;
};



as well as the no-namespace-version

#include <string>
class Test
{
friend bool operator==( const Test& lhs, const Test& rhs );
private:
std::string s;
};
bool operator==( const Test& lhs, const Test& rhs )
{ return ( lhs.s == rhs.s ); }



Any ideas? Perhaps something in the compiler settings? Or is it just a compiler-bug?

Any help is much appreciated

Joerg