Fixes #9947

I couldn't think of any way to do it other than duplicating the classes which is obviously quite brittle.
Let me know if you have any better ideas!