How do I write a custom inspector for a child class while displaying the parent class's default inspector?

I have a class ClassA and another class ClassB that inherits from ClassA. I want ClassB to have a custom inspector that shows all of ClassA’s default inspector plus the special fields and functionality for ClassB’s variables. How do I draw ClassA’s default inspector from ClassB’s custom inspector script? I would rather not build ClassA’s default inspector inside ClassB (by using serializedObject.FindProperty() and EditorGUILayout.PropertyField()), because if ClassA ever changes, I would need to update ClassB’s custom inspector.

Use reflection to get all variables present in the child class (not including inherited variables), then use Unity’s DrawPropertiesExcluding() method to draw all the properties except the child’s variables. This will effectively draw only the parent’s variables. Then manually draw the child’s variables with the custom features. Here is the code for Class B’s OnInspectorGUI():

public override void OnInspectorGUI()
{
    serializedObject.Update();
    
    DrawPropertiesExcluding(serializedObject, GetVariables());

    // Insert custom inspector code here

    serializedObject.ApplyModifiedProperties();
}

And the helper method GetVariables():

private string[] GetVariables()
{
    List<string> variables = new List<string>();
    BindingFlags bindingFlags = BindingFlags.DeclaredOnly | // This flag excludes inherited variables.
                                BindingFlags.Public |
                                BindingFlags.NonPublic |
                                BindingFlags.Instance |
                                BindingFlags.Static;
    foreach(FieldInfo field in typeof(ClassB).GetFields(bindingFlags))
    {
        variables.Add(field.Name);
    }
    return variables.ToArray();
}