Can you create class based on another class without inheritance

Im creating a system where i need two very similar classes but do not exactly share the same variables.
Im using a custom struct named optional so i need to create a script where based on a previous script it generates a new one.
Here is an example:

public class BaseStats
{
    public float cooldown;
    public float power;
    public float precision;
}

And it should generate the following:

public class StatsModifier : MonoBehaviour
{
    public Optional<float> cooldown;
    public Optional<float> power;
    public Optional<float> precision;
}

I don’t know if this is even possible but all i see is about inheritance which I don’t think would work here. If there is something that could do this could it also add an operator overload function adding all the new elements added?

One way to do this would be to use a code generator.