I get a compiling error in the main fuction 'cout << a.GetVect() ; '
I am not sure whether the problem is in the overloading function or in class.
Anyone has any idea why I take this error?
you can check the compiled code and errors in http://ideone.com/ODOJik
Thanks in advance..

#include <cstdlib>
#include <iostream>
#include <vector>
#include "OverLoad.h"
#include <cmath>

using namespace std;

class Overload {
    Overload operator+(Overload &) ;
    void SetK(int k);
    int GetK() const;
    void SetVect(vector<double> vect);
    vector<double> GetVect() const;

    vector<double> vect ;
    int k ;


int main(int argc, char** argv) {

    Overload a,b(10),c(10) ;
    a = b+c ;

    cout << a.GetVect() ;   
    return 0;

Overload::Overload() {
    k=10 ;
    for(unsigned int i=0;i<k ; ++i){
        double res = 1/pow(i,2) ;

Overload::Overload(int k) {

    for(unsigned int i=0;i<k ; ++i){
        double res = 1/pow(i,2) ;

Overload Overload::operator+(Overload &a){

    Overload x ;
    for(unsigned int i=0 ;i<vect.size();i++) {
        double res = vect[i] + a.vect[i];
         x.vect.push_back(res) ;
    return x ;

void Overload::SetK(int k) {
    this->k = k;

int Overload::GetK() const {
    return k;

void Overload::SetVect(vector<double> vect) {
    this->vect = vect;

vector<double> Overload::GetVect() const {
    return vect;

The error you are getting is saying that it can’t find an operator << that will take a vector. The vector class does not have built in stream operators so if you want to pass a vector to << than you need to write your own function to do that.

commented: You are saying I should oveload << operator? +0

I found it It must be

for(unsigned int i=0;i <10;++i)
    cout << a.GetVect()[i] ; 

Thats all :)