Implement support for __str__ and __repr__ special methods in classes.
diff --git a/py/objtype.c b/py/objtype.c
index 9eb228c..6480a99 100644
--- a/py/objtype.c
+++ b/py/objtype.c
@@ -78,6 +78,21 @@
 }
 
 STATIC void class_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t self_in, mp_print_kind_t kind) {
+    mp_obj_class_t *self = self_in;
+    qstr meth = (kind == PRINT_STR) ? MP_QSTR___str__ : MP_QSTR___repr__;
+    mp_obj_t member = mp_obj_class_lookup(self->base.type, meth);
+    if (member == MP_OBJ_NULL && kind == PRINT_STR) {
+        // If there's no __str__, fall back to __repr__
+        member = mp_obj_class_lookup(self->base.type, MP_QSTR___repr__);
+    }
+
+    if (member != MP_OBJ_NULL) {
+        mp_obj_t r = rt_call_function_1(member, self_in);
+        mp_obj_print_helper(print, env, r, PRINT_STR);
+        return;
+    }
+
+    // TODO: CPython prints fully-qualified type name
     print(env, "<%s object at %p>", mp_obj_get_type_str(self_in), self_in);
 }
 
diff --git a/py/qstrdefs.h b/py/qstrdefs.h
index 2678526..8f6cc11 100644
--- a/py/qstrdefs.h
+++ b/py/qstrdefs.h
@@ -21,6 +21,8 @@
 Q(__setitem__)
 Q(__add__)
 Q(__sub__)
+Q(__repr__)
+Q(__str__)
 
 Q(micropython)
 Q(byte_code)