Updated: this convention is outdated and OP's original code did it better.
The convention for swap, instead of declaring it friend, is to provide a public member function swap as well as specializing std::swap for your type.
namespace std {
template<> void swap<Widget>(Widget& a, Widget& b)
{
a.swap(b);
}
}
Your class is templated and you can't partially specialize in std yourself. So you would have to provide a non-member swap function outside your class in your namespace.
template<typename T> void swap(unique_ptr<T>& a, unique_ptr<T>& b)
{
a.swap(b);
}
Reference: Effective C++ 55 Specific Ways to Improve Your Programs and Designs, Item 25