Move piecewise minimum_distance after normal implementations
Improve handling of call to std::sort in minimum_distance for piecewise curves.
Correct friend specification in piecewise curve.