the error says " the call on the overloaded swap function is ambiguous"
Note: if the 1st 2 calls are commented out it will compile and the last swap call works.
The STL already defines a template function named swap, so the compiler thinks you are overloading it. Both your function and theirs take two parameters of type T so the compiler is not sure whether to use your function or theirs.
The simplest fix would probably be to rename your function.