Adds #include <functional>

Coincidentally std::ref worked because something else was including
<functional>.