Form Biggest Number

how the myCompare() actually works when we are using the inbuilt sort function of Algorithm header file

bool mycompare(int a, int b) {
string str1 = to_String(a)
string str2 = to_String(b)
return str1+str2 > str2 + str1
}
I need to support the arrays which form the biggest number
Please explain me how it will internally works it seems little confusing to me
// suppose we have the arrays 54, 546, 548,60
sort(a,a+n,myCompare())