Fixed swap method because stringstreams are noncopyable.