To achieve your own sort order you must overwrite the sorting algorithm, by overwriting the comparison operator "<" which is repeatly called in a sort call.
For a deeper inside read and understand the great article
STL Sort Comparison Function.
Tip: make a small sample list and debug it to understand what is happening.