You have several issues in your code.
This is the reason for your error message. You don't
#include <iostream>
inPoint2D.h
/Line2D.h
.As others already suggested, use
std::istream
instead of justistream
.The correct
operator>>()
should bestd::istream &operator>>(std::istream &is, Point2D &p2d);
Note the
std::istream&
and thePoint2D&
.Point2D&
is important, because otherwise you modify a local copy and the given parameter remains unchanged.Your input operator is fragile. It is vulnerable to having more or less whitespace. You also allow exactly one digit for
x_coordinate
. Additionally, you skip one character beyondPoint2D,
. A better approach could be to separate the parts with just whitespace and let the iostream library handle the parsing. E.g.Point2D 15 28
could be read by
string tag; is >> tag; if (tag == "Point2D") is >> p2d.x >> p2d.y; return is,