class S;

template<class T>
int f(T, S);

class S {
  template<class T>
  friend int f(T t, S) { t; return 0; }
};


syntax highlighted by Code2HTML, v. 0.9.1