In my .cpp file I got
Student:: friend istream& operator>>(istream &input,Student &a){
input>>a.AM>>a.name>>a.semester>>;
return input;
}
And in my .h file I got
friend istream &operator>>(istream &input,Student &a);
I keep getting that error and I don't know what to do.Any help?
CodePudding user response:
Rewrite the definition like
istream& operator>>(istream &input,Student &a){
input>>a.AM>>a.name>>a.semester>>;
return input;
}
The specifier friend is used only in a declaration of a friend function within a class.
And a friend function is not a member of the class granting friendship.