title: pydantic's update_forward_refs raises typing NameError
body: <p>Python 3.9 - I have the following module:</p>
  <pre class="lang-py prettyprint-override"><code>from __future__ import annotations
  from typing import TYPE_CHECKING
  from pydantic import BaseModel
  
  if TYPE_CHECKING:
      from typing import Optional
  
  class A(BaseModel):
      id: int
      class Config:
          orm_mode = True
  
  class B(A):
      foo: C
  
  class C(A):
      bar: Optional[str]
  
  C.update_forward_refs()
  
  c = C(id=1, bar='bar')
  b = B(id=2, foo=c)
  </code></pre>
  <p>When I import this module it raises <code>NameError: name 'Optional' is not defined</code>. I can remove the <code>if TYPE_CHECKING</code> part, but I understand that this is the best practice (to prevent circular imports if I use my own types for example).
  When I remove the <code>B.update_forward_refs()</code> call it raises <code>pydantic.errors.ConfigError: field &quot;foo&quot; not yet prepared so type is still a ForwardRef, you might need to call B.update_forward_refs().</code></p>
  <p>Any idea how to overcome this?</p>