Not all compilers recognize front() and back() of std::string.

Re #7623