文件流操作符重载时出现的有关问题,还有涉及到类模板

文件流操作符重载时出现的问题,还有涉及到类模板
error C2679: binary '>>' :no operator defined which takes a right-hand operand of type
 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' 
(or there is no acceptable
自定义数据类型user
头文件中的声明

#include "iostream"
#include <string>
using namespace std;

#ifndef USER
#define USER
class user
{
public:
user();
user(string id);
~user();
public:
string ID;
string password;
//原本是想写成private的,但是无法存取我又改过来试试,还是不行
public:
string getID();
string getpassword();
void setID(string id);
void setpassword(string word);
bool check(string id,string word);
const bool user::operator == (user &use);
const bool user::operator < (user &use);
const bool user::operator > (user &use);
friend ifstream& operator <<(ifstream &ifs,user data);
friend ofstream& operator <<(ofstream &ofs,user &data);

};

#endif
[code=c]
操作符重载在cpp中的实现
 conversion)[code=c]
ifstream& operator >>(ifstream &ifs,user &data)
{
ifs>>data.ID>>data.password;
}

ofstream& operator <<(ofstream &ofs,user data)
{
ofs<<data.ID<<data.password;
}

还有就是用到的地方,AVL树挺长的就不放了,编译的时候这是第一个错误,前面的应该都改对了的。
这里面的p->data 就是我自己定义的类型user

template <typename DataType>
void AVLTree<DataType>::Save(AVLNodePointer p,ofstream &fout)
{
    fout<<p->data<<endl;
    if (p->left)
Save(p->left,fout);
    if (p->right)
Save(p->right,fout);
}

------解决思路----------------------
 friend ifstream& operator <<(ifstream &ifs,user data);
    friend ofstream& operator <<(ofstream &ofs,user &data);
你这里重载了两遍<<,并没有重载>>
但cpp中却一个是<<,一个是>>
很明显的错误啊
------解决思路----------------------
引用:
谢谢!啊,之前这块弄内容忘的差不多了,看了好一会书再写的。前面又改了很多错误头都晕了,这个记得不熟所以改了很久也没改不出来,无奈才跑来问的,没想到这次是不小心打错了。哎,做了的差不多到这里竟然没发现。。


出小错误很正常!其实编译错误的提示信息已经提示什么错误了,我们只需要静下心来,不焦不躁即可
------解决思路----------------------
都是Ctrl C,Ctrl V惹的祸,不怪楼主,呵呵。