Repository: strawberry-graphql/strawberry

Issue:
`strawberry.experimental.pydantic.type` doesn't reach the custom `resolve_reference` method
<!-- Provide a general summary of the bug in the title above. -->

<!--- This template is entirely optional and can be removed, but is here to help both you and us. -->
<!--- Anything on lines wrapped in comments like these will not show up in the final text. -->

## Describe the Bug

<!-- A clear and concise description of what the bug is. -->
I am facing an issue with integrating pydantic with apollo federation.

```python
import strawberry
from pydantic import BaseModel
from strawberry.federation.schema_directives import Key

def test_fetch_entities_pydantic():
    class ProductInDb(BaseModel):
        upc: str
        name: str

    # @strawberry.federation.type(keys=["upc"])
    @strawberry.experimental.pydantic.type(
        model=ProductInDb, directives=[Key(fields="upc", resolvable=True)]
    )
    class Product:
        upc: str
        name: str

        @classmethod
        def resolve_reference(cls, upc):
            return Product(upc=upc, name="test")

    @strawberry.federation.type(extend=True)
    class Query:
        @strawberry.field
        def top_products(self, first: int) -> typing.List[Product]:
            return []

    schema = strawberry.federation.Schema(query=Query, enable_federation_2=True)

    query = """
        query ($representations: [_Any!]!) {
            _entities(representations: $representations) {
                ... on Product {
                    upc
                }
            }
        }
    """

    result = schema.execute_sync(
        query,
        variable_values={
            "representations": [{"__typename": "Product", "upc": "B00005N5PF"}]
        },
    )

    assert not result.errors

    assert result.data == {"_entities": [{"upc": "B00005N5PF"}]}
```
```
>       assert not result.errors
E       assert not [GraphQLError("Unable to resolve reference for <class 'types.Product'>", locations=[SourceLocation(line=3, column=13)], path=['_entities', 0])]
E        +  where [GraphQLError("Unable to resolve reference for <class 'types.Product'>", locations=[SourceLocation(line=3, column=13)], path=['_entities', 0])] = ExecutionResult(data={'_entities': [None]}, errors=[GraphQLError("Unable to resolve reference for <class 'types.Product'>", locations=[SourceLocation(line=3, column=13)], path=['_entities', 0])], extensions={}).errors
```

I have identified the issue lies in [the line](https://github.com/strawberry-graphql/strawberry/blob/cf4e491b5c49877f55664c951f18970fc2c4699e/strawberry/federation/schema.py#L162) `if hasattr(definition.origin, "resolve_reference")` is not evaluating to True, which means that the `Product` type does not have the "resolve_reference" method.

## System Information

 - Strawberry version (if applicable): 0.155.2




Discussion:

Resolving patch:
diff --git a/strawberry/experimental/pydantic/object_type.py b/strawberry/experimental/pydantic/object_type.py
--- a/strawberry/experimental/pydantic/object_type.py
+++ b/strawberry/experimental/pydantic/object_type.py
@@ -214,6 +214,9 @@ def is_type_of(cls: Type, obj: Any, _info: GraphQLResolveInfo) -> bool:
         if has_custom_to_pydantic:
             namespace["to_pydantic"] = cls.to_pydantic
 
+        if hasattr(cls, "resolve_reference"):
+            namespace["resolve_reference"] = cls.resolve_reference
+
         kwargs: Dict[str, object] = {}
 
         # Python 3.10.1 introduces the kw_only param to `make_dataclass`.


Test patch:
diff --git a/tests/experimental/pydantic/schema/test_federation.py b/tests/experimental/pydantic/schema/test_federation.py
new file mode 100644
--- /dev/null
+++ b/tests/experimental/pydantic/schema/test_federation.py
@@ -0,0 +1,53 @@
+import typing
+
+from pydantic import BaseModel
+
+import strawberry
+from strawberry.federation.schema_directives import Key
+
+
+def test_fetch_entities_pydantic():
+    class ProductInDb(BaseModel):
+        upc: str
+        name: str
+
+    # @strawberry.federation.type(keys=["upc"])
+    @strawberry.experimental.pydantic.type(
+        model=ProductInDb, directives=[Key(fields="upc", resolvable=True)]
+    )
+    class Product:
+        upc: str
+        name: str
+
+        @classmethod
+        def resolve_reference(cls, upc):
+            return Product(upc=upc, name="")
+
+    @strawberry.federation.type(extend=True)
+    class Query:
+        @strawberry.field
+        def top_products(self, first: int) -> typing.List[Product]:
+            return []
+
+    schema = strawberry.federation.Schema(query=Query, enable_federation_2=True)
+
+    query = """
+        query ($representations: [_Any!]!) {
+            _entities(representations: $representations) {
+                ... on Product {
+                    upc
+                }
+            }
+        }
+    """
+
+    result = schema.execute_sync(
+        query,
+        variable_values={
+            "representations": [{"__typename": "Product", "upc": "B00005N5PF"}]
+        },
+    )
+
+    assert not result.errors
+
+    assert result.data == {"_entities": [{"upc": "B00005N5PF"}]}