title: Defining a custom type that works with `typing.get_type_hints()`
body: <p>I want to use a type hint that is an object with some structure, as follows:</p>
  
  <pre><code>import typing
  
  
  class MyType:
      def __init__(self, param):
          self.param = param
  
  
  def func(a: MyType(1)):
      pass
  
  
  print(typing.get_type_hints(func))
  </code></pre>
  
  <p>This runs fine, producing</p>
  
  <pre><code>{'a': &lt;__main__.MyType object at 0x107a3c110&gt;}
  </code></pre>
  
  <p>But if one adds</p>
  
  <pre><code>from __future__ import annotations
  </code></pre>
  
  <p>at the beginning of the code, mimicking the default behavior of Python 3.8+ (converting the annotation to a string that gets evaluated in <code>get_type_hints()</code>), it produces an error</p>
  
  <pre><code>TypeError: Forward references must evaluate to types. Got &lt;__main__.MyType object at 0x10f4ff0d0&gt;
  </code></pre>
  
  <p>Is it possible to make this work with the new annotation behavior? As far as I understand I need to subclass <code>MyType</code> making its objects types themselves, but I cannot figure out which base class I am supposed to use.</p>