Can’t extend some core classes

You can extend it, but the class definition and any code that uses it, can’t run outside of the admin area.

Wrap your class in this conditional:

if ( is_admin() ) {
    ...
}

If you are trying to use this on the frontend or other non-Admin areas, do not do that.

Generally, classes WordPress uses should not be extended, walker classes and WP_Widget are the notable extensions.

Also, it’s good practice to put classes in their own files.