-3
istream& operator>> (istream &in, vector <Customer>& cvect)
{
    while (!in.eof())
    {
         //read from file into cvect vector
    }
    return cvect;
}

For this i get "invalid initialization of reference of type cvect". What am i doing wrong?

Gribbles Chan
  • 123
  • 1
  • 3
  • 9

1 Answers1

6

Your function says it will return a istream reference:

istream& operator>> (istream &in, vector <Customer>& cvect)

Your compiler believes you. You then say

return cvect;

This is not an istream, it's a vector. Try returning the istream as you promised you would:

return in;
doctorlove
  • 18,872
  • 2
  • 46
  • 62