How to overload istream operator?

Hey guys, I've been working on this assignment where I have to implement a class Matrix in which I have to take input from user by overloading >> operator. The problem is that I can't define the >> operator in Matrix.h nor in Matrix.cpp because it gives an error on compilation. Help me out please.
1) This should be in the "General C++ Programming" forum.
2) Where is your code? Can't help if we can't see where in your code the problem lies ;)
you probably want something like this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
class Matrix
{
public:
  friend std::istream& operator>>(std::istream& is, Matrix& m);
};

std::istream& operator>>(std::istream& is, Matrix& m)
{
  // double point;
  // is >> point;
  // m.InstertPoint(point);

  return is;
}
Topic archived. No new replies allowed.