The reason comes down to how templates are instantiated. In essence, a template can only be instantiated for types that have external linkage (in your context, they cannot be anonymous). If you want to avoid cluttering the global namespace with your algorithms, place them in a namespace of their own.
In this example, as you're using <algorithm> anyway, why not use this?
return *( std::max_element(s.begin(), s.end(), std::less<int>()) );