add functional header for std::less
mv template function definition to .h files for compiler to find it