いやこれ1週間考えても無理だって。
>>990
こうfriend宣言するとコンパイルして実行までいける。
template<class U>
friend std::ostream& operator <<(std::ostream& stream, const Test<U>& a);
http://msdn.microsoft.com/en-us/library/f1b2td24.aspx

UではなくTのままでもVC++ではコンパイルできるが、
g++では外側のTと被ると怒られる。