#include template struct foo { T t; foo():t(0){} void swap(foo& x){swap_(x);} void swap_(foo& x) { using std::swap; swap(t,x.t); } }; template void swap(foo& x,foo& y) { x.swap(y); } int main() { foo x,y; x.swap(y); }