diff --git a/core/OOP.hh b/core/OOP.hh
index 4dced3ffa091f792d8702dc2fa4e1af16ade0927..c72d9ef0acc6d50a3744abe86442d4bdd49d7133 100644
--- a/core/OOP.hh
+++ b/core/OOP.hh
@@ -79,6 +79,19 @@ public:
     }
   }
   
+  template <typename T2>
+  OBJECT_REF(OBJECT_REF<T2>& p_other) {
+    if (p_other != NULL_VALUE) {
+      ptr = dynamic_cast<T*>(*p_other);
+      if (ptr != NULL) {
+        ptr->add_ref();
+      }
+      else {
+        TTCN_error("Invalid dynamic type of initial value.");
+      }
+    }
+  }
+  
   void clean_up() {
     if (ptr != NULL) {
       if (ptr->remove_ref()) {
@@ -106,6 +119,21 @@ public:
     return *this;
   }
   
+  template <typename T2>
+  OBJECT_REF& operator=(OBJECT_REF<T2>& p_other) {
+    clean_up();
+    if (p_other != NULL_VALUE) {
+      ptr = dynamic_cast<T*>(*p_other);
+      if (ptr != NULL) {
+        ptr->add_ref();
+      }
+      else {
+        TTCN_error("Invalid dynamic type of assigned value.");
+      }
+    }
+    return *this;
+  }
+  
   boolean operator==(null_type) const { // equality operator (with null reference)
     return ptr == NULL;
   }
diff --git a/regression_test/oop/oop.ttcn b/regression_test/oop/oop.ttcn
index 5501f168b4a6c564896faf873139296fb9066028..6e0d2d17c19190a691cc45f3f1f86bcbf16ebc23 100644
--- a/regression_test/oop/oop.ttcn
+++ b/regression_test/oop/oop.ttcn
@@ -269,6 +269,15 @@ testcase tc_equality() runs on CT {
   if (v_ref2 != v_base) {
     setverdict(fail, "Inequality of object and indirect reference to object failed");
   }
+  
+  var SubClass v_sub := SubClass.create(4, { 1, 2, 4 }, "a", 'FF'O, (0.0 .. 10.0));
+  var BaseClass v_ref3 := v_sub;
+  if (not v_ref3 == v_sub) {
+    setverdict(fail, "Equality of subclass object and superclass reference failed");
+  }
+  if (v_ref3 != v_sub) {
+    setverdict(fail, "Inquality of subclass object and superclass reference failed");
+  }
   setverdict(pass);
 }