forward declare header string definitions

Right now, toString functions are declared in the header. This causes
problems when an earlier function references a later function as they
are not forward declares. Now, files are in this order (in C++):

 * includes
 * declarations of types
 * forward declarations of header definitions (added in this CL)
 * header definitions
 * declarations/definitions at the android::hardware scope

Fixes: 117342189
Test: hidl_test
Test: m android.hardware.tests.baz@1.0 android.hardware.tests.baz-V1.0-java
    (this runs hidl-gen on this for both Java and C++ output)
Test: manually inspected output

Change-Id: Ib52425f6167302f852cd3590b91dec9dd940edb2
diff --git a/Interface.cpp b/Interface.cpp
index dae7535..117dd65 100644
--- a/Interface.cpp
+++ b/Interface.cpp
@@ -849,6 +849,12 @@
 void Interface::emitPackageTypeDeclarations(Formatter& out) const {
     Scope::emitPackageTypeDeclarations(out);
 
+    out << "static inline std::string toString(" << getCppArgumentType() << " o);\n\n";
+}
+
+void Interface::emitPackageTypeHeaderDefinitions(Formatter& out) const {
+    Scope::emitPackageTypeHeaderDefinitions(out);
+
     out << "static inline std::string toString(" << getCppArgumentType() << " o) ";
 
     out.block([&] {