テンプレートでのoperator関数の使用上の注意

#include <iostream>

using namespace std;

template <typename Z>
class Vec2
{
	public:
		Z v[2];
		Vec2();
		Vec2(Z, Z);
		friend Vec2<Z> operator + <>(Vec2<Z>, const Vec2<Z>&);
		void print();
};

template <typename Z>
Vec2<Z>::Vec2() {v[0] = v[1] = 0.0; }

template <typename Z>
Vec2<Z>::Vec2(Z X, Z Y) { v[0] = X; v[1] = Y; }

template <typename Z>
Vec2<Z> operator + (Vec2<Z> a, const Vec2<Z>& b)
{
	return Vec2<Z>(a.v[0] + b.v[0], a.v[1] + b.v[1]);
}

template <typename Z>
void Vec2<Z>::print()
{
	cout << "Vec2(" << v[0] << "," << v[1] << ")\n";
}

void main()
{
	Vec2<float> a(1.1f, 2.2f), b(0.3f, 0.4f), c;
	c = a + b;
	cout << "a     = "; a.print();
	cout << "b     = "; b.print();
	cout << "a + b = "; c.print();
}
テンプレートでのクラス内のfriend関数宣言箇所でfriend クラス名 operator + <>(...)と書く