So what I am trying to do is make the sum operator do the some of 2 elements of class but I have an issue when modifying the class constructor In this code
#include<iostream>
using namespace std;
class Baza {
public:
    int a;
    int b;
    int c;
    Baza(double x, double y){
        this->a=x;
        this->b=y;
    }
    
    Baza Suma(const Baza& val) const{
        return Baza(a+val.a,b+val.b);
        
    }
    Baza operator+(const Baza& val) const{
        return Suma(val);
    }
    
};
class Derivata : public Baza {
    
public:
    int o;
    int p;
    Derivata(double x, double y) : Baza(x,y){
    this->o = x ;
    this->p = y;
    }
    Derivata Suma(const Derivata& val) const{
        return Derivata(a+val.a,b+val.b);
    }
    Derivata operator+(const Derivata& val) const{
        return Suma(val);
    }
    
};
ostream& operator<<(ostream& os, const Baza& val) {
    os << val.a << ',' << val.b;
    return os;
}
int main() {
    Baza obd1(2,3);
    cout << obd1 << endl;
    Baza obd2(4,5);
    cout << obd2 << endl;
    Baza obd3 = obd1 + obd2;
    cout << obd3 << endl;
    /*
    Derivata obiect1(5,6);
    Derivata obiect2(10,3);
    Derivata obiect3 = obiect1 + obiect2;
    cout << obiect3 << endl;
    return 0;
    */
}
The algorithm works , makeing the right sum for objects ob1 and ob2 , but if I am trying to change the "Baza" constructor like this Baza(double x, double y){ this->a=x + 5; this->b=y; }
The sum won't add up . Any ideas ?
 
    