Firstly, you use both
arr is an array and
ar is a list. This is both confusing to the reader and (it turns out) to the code author.
In C++, std::list doesn’t have random access. You cannot use
ar, since operator is not defined for lists. Further,
largestOfArray expects an array, not a list. You probably intended to use
arr there instead of