클레스 템플릿 friend 파일분활질문있습니다 ㅠ

rnjsqhs1628의 이미지

좌표.h
 
 
 
 
#ifndef __B__
#define __B__
 
#include <iostream>
using namespace std;
 
template <typename O>
class P
{
private:
        O x;
        O y;
 
public:
 P(O a=0,O b=0);
 friend ostream& operator<<(ostream& o,const P<int> &p);
};
 
 
#endif

좌표.cpp
 
 
 
 
#include "좌표.h"
 
template <typename O>
P<O>::P(O a,O b) : x(a),y(b) {}
 
 
ostream& operator<<(ostream& o,const P<int> &p)
{
 o<<"["<<p.x<<","<<p.y<<"]"<<endl;
 return o;
}

좌표.obj : error LNK2005: "class std::basic_ostream > & __cdecl operator<<(class std::basic_ostream > &,class P const &)" (??6@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@AAV01@ABV?$P@H@@@Z)이(가) 메인.obj에 이미 정의되어 있습니다.
c:\users\administrator\documents\visual studio 2010\Projects\rrewrw\Debug\rrewrw.exe : fatal error LNK1169: 여러 번 정의된 기호가 있습니다.

이런식으로 오류가나네요 ㅠ.. 근데 좌표 cpp 를 좌표.h 에 같이 놔두면 컴파일은 또되네요 .. 뭐가잘못된거지좀 알려주세요 ㅠ

감사합니다!

rnjsqhs1628의 이미지

1