为啥友元重载一直无法访问私有成员数据

为什么友元重载一直无法访问私有成员数据?
ude<iostream>
using namespace std;
class stu
{
private:
int a[3];
double b[3],c[3];
public:
stu();
friend int operator>(const stu &A,const stu &B);
/* int operator>(const stu &A,const stu &B)
{
double x=0.0,y=0.0;
for(int j=0;j<3;j++)
{
x+=A.b[j]*A.c[j];
y+=B.b[j]*B.c[j];
}
if(x>y)
return 1;
else if(x==y)
return 0;
else
return -1;
}*/
};
stu::stu()
{
cout<<"请输入该同学各科成绩及学分:"<<endl;
for(int i=0;i<3;i++)
{
cin>>a[i]>>b[i];
if(a[i]<=100&&a[i]>95)
c[i]=5.0;
else if(a[i]<=60)
c[i]=0;
else 
c[i]=(a[i]-60)/10;
}

}
int operator > (const stu &A,const stu &B)
{
double x=0.0,y=0.0;
for(int j=0;j<3;j++)
{
x+=A.b[j]*A.c[j]; //这显示无法访问。
y+=B.b[j]*B.c[j]; //估计这里的结果也是一样。
}

if(x>y)
return 1;
else if(x==y)
return 0;
else
return -1;

int main()
{
stu A;
stu B;
int x;
x=A>B; //
cout<<"比较结果为:"<<x<<endl;
return 0;
}
想了一个小时45分了,依然没弄明白。我有尝试把 double x=0.0,y=0.0;
for(int j=0;j<3;j++)
{
x+=A.b[j]*A.c[j];
y+=B.b[j]*B.c[j];
}写到类里,可是mian()函数里的x=A>B 提示有歧议……

------解决方案--------------------

算是VC++6.0的命名空间的bug吧。。。
要不就定义在类中友元函数 
要不修改为#include <iostream.h>
要不换编译器
------解决方案--------------------
你在那个环境下编译的呀,我在vs2010下编译通过,执行也没有问题呀
------解决方案--------------------
VC6太老了。建议楼主还是换成新版的VS编译器。VC6出来的时候C++标准还没有出来呢