Even so, this is only available within the scope of the declaring function. To add a function to your DebugPrinter object, you need to put that declaration in the header file, as an inline function definition.
Also remember that UE4 by default uses C++14, so there’s even valid C++ parts that don’t work yet. This isn’t entirely EPIC’s fault – the UE has to run in a bunch of environments, including vendor-specific console devkits, that may have older compilers than you’d find if you just kept up with the latest and greatest.