async: client: avoid ambiguous base-class error

When using multiple generated client classes with client_t, we
can end up with an ambiguous base-class error.  Change the way
the `client_context_friend` utility derives the context pointer
from the `Client` template type, to avoid the ambiguity.

Previous failure when inheriting both `state::BMC` and `state::Host`
into a single `client_t`:

```
error: 'sdbusplus::async::client::details::client_context_friend' is an ambiguous base of 'sdbusplus::async::client::client<true, true, false, sdbusplus::client::xyz::openbmc_project::state::BMC, sdbusplus::client::xyz::openbmc_project::state::Host>'
         return static_cast<T*>(this)->ctx;
```

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I047f00ca8df071eef13e8fdd71a56910cc7b3e26
diff --git a/include/sdbusplus/async/client.hpp b/include/sdbusplus/async/client.hpp
index 25bba41..44f4565 100644
--- a/include/sdbusplus/async/client.hpp
+++ b/include/sdbusplus/async/client.hpp
@@ -95,10 +95,10 @@
  */
 struct client_context_friend
 {
-    template <typename T>
-    sdbusplus::async::context& context()
+    template <typename Client, typename Self>
+    static sdbusplus::async::context& context(Self* self)
     {
-        return static_cast<T*>(this)->ctx;
+        return static_cast<Client*>(self)->ctx;
     }
 };
 } // namespace client::details
diff --git a/tools/sdbusplus/templates/interface.client.hpp.mako b/tools/sdbusplus/templates/interface.client.hpp.mako
index 7963a53..e1ec282 100644
--- a/tools/sdbusplus/templates/interface.client.hpp.mako
+++ b/tools/sdbusplus/templates/interface.client.hpp.mako
@@ -44,7 +44,7 @@
 template <typename Client, typename Proxy>
 class ${interface.classname} :
     public sdbusplus::common::${interface.cppNamespacedClass()},
-    public sdbusplus::async::client::details::client_context_friend
+    private sdbusplus::async::client::details::client_context_friend
 {
   public:
     friend Client;
@@ -70,7 +70,7 @@
     sdbusplus::async::context& context()
     {
         return sdbusplus::async::client::details::client_context_friend::
-            context<Client>();
+            context<Client, ${interface.classname}>(this);
     }
 
     decltype(std::declval<Proxy>().interface(interface)) proxy = {};