Beacuse the two swap functions called inside swap(HasPtr &lhs, HasPtr &rhs) are the overloaded versions of swap function in standard library.