C++ vektor of objects : im learning the concept of OOP , i made simple program that reads names of students and store them inside vektor of objects ; a created a class students 

    class student{
    public:
    
    
            student(string,int);
    
            string getName() const{
                return name;
            }
    
            int getAge() const{
                return age;
            }
    
    
    private:
        string name;
        int age;
    
    
    };
    
    student::student(string name,int age){
        name=name;
        age=age;
    
    }

and in main i read lines as 

 

    vector<student> myClass;
        string var;
        int index=0;
        while(getline(cin,var)){
        
            student newStudent(var,index);
            myClass.push_back(newStudent);
    
         }
        for( int i = 0; i < 5; i++){
            cout << myClass[i].getName() << endl;
        }
    
        return 0;

But as i want to print names ,it only prints blank lines , i tried to print name right after inicializing class in while loop and it also print blank lines. Im quite new to OOP and i do not see any problem here, what did i overlook? Where is a bug in my little program?