[완료] C++ 에서 cin >> 연산자 오버로딩 할때,,,,,,,

k3rnel의 이미지

안녕하세요
제가 작성한 클래스 Point대한 처리를 cin >> 연산자 오버로딩해서 처리하려고 아래와 같은 코드를 작성하였습니다.

#include <iostream>
using std::endl;
using std::cout;
using std::cin;
using std::ostream;
 
class Point {
private:
int x, y;
public:
Point(int _x=0, int _y=0) :x(_x), y(_y){}
friend ostream& operator>>(ostream& os,  Point& p);
};
 
ostream& operator>>(ostream& os,  Point& p)
{
os >> p.x >> p.y;                           // <<<<<<<< 18번째줄
return os;
}
 
int main( void )
{
Point p;
cin >> p;                                 // <<<<<<<<<<<< 25번쨰 줄
return 0;
}

에러
c_plus_test.cpp(18) : error C2679: binary '>>' : no operator defined which takes a right-hand operand of type 'int' (or there is no acceptable conversion)
c_plus_test.cpp(25) : error C2679: binary '>>' : no operator defined which takes a right-hand operand of type 'class Point' (or there is no acceptable conversion)

VC++ 6.0 에서 컴파일 하였는데 위와 같은 에러가 나는데 이유를 잘 모르겠습니다.
어떤것을 수정해야까요? 답변 부탁드릴께요

수고하세요^^

익명사용자의 이미지

istream& operator>>(istream& is,  Point& p)
k3rnel의 이미지

답변 감사합니다 해결했습니다 (_ _)^^