diff --git a/src/pystencils/backend/symbols.py b/src/pystencils/backend/symbols.py
index e1db5a930805939ffb28432023bc564158d8f43c..9b0d815460a9a7776ac203d4e8931faa32337fc1 100644
--- a/src/pystencils/backend/symbols.py
+++ b/src/pystencils/backend/symbols.py
@@ -45,6 +45,16 @@ class PsSymbol:
             raise PsInternalCompilerError("Symbol had no type assigned yet")
         return self._dtype
 
+    def __eq__(self, other: object) -> bool:
+        return (
+            type(self) == type(other)
+            and self._name == other._name
+            and self._dtype == other._dtype
+        )
+
+    def __hash__(self) -> int:
+        return hash((self._name, self._dtype))
+
     def __str__(self) -> str:
         dtype_str = "<untyped>" if self._dtype is None else str(self._dtype)
         return f"{self._name}: {dtype_str}"