trouble with friend function : <p>so my program is that i want the user to enter information about a board so everything is working except the part where i need the user to enter the value of attitude then add another number to increase that attitude so I'm stuck at this. As you can see I declared this function as a friend but when I enter the number that I need to increase it to the value of attitude) it stays the same! I hope I made clear the problem I'm facing! and I'd appreciate some help</p>

<pre><code>#ifndef BOARD_H
#define BOARD_H
class Board {


friend void incAttitude(Board &amp;);


public:

friend void incAttitude(Board &amp;);

static int boardcount;
Board(int=5,int=3,double=1.5,char* ='\0');
~Board();
Board &amp;setBoard(int,int,double,char*);
char getLocation();
Board &amp;print();
double surface();


private:

const int length;
int width;
double attitude;
char location[30];


};
#endif
#include&lt;iostream&gt;
#include&lt;cstring&gt;
#include&lt;string&gt;
#include&lt;assert.h&gt;

using namespace std;
#include "Board.h"

int Board::boardcount=0;

Board::Board(int l,int w,double a,char* lo)
    : length(l)
{
width=w;
attitude=a;
location[0]='\0';
boardcount++;
}


Board::~Board(){

boardcount--;
}

Board &amp;Board::setBoard(int l,int w,double a,char* lo)

{   
    width=(w&gt;=2 &amp;&amp; w&lt;=5)?w:3;
    attitude=(a&gt;=1.5 &amp;&amp; a&lt;=2.8)?a:1.5;
    strncpy_s(location,lo,29);
    location[29]='\0';
    return *this;
}
char Board::getLocation(){


    return *location;

}

double Board::surface(){

return length*width;
}

void incAttitude(Board &amp;h)
{
 double incAttitude;
cout&lt;&lt;"enter to increase attitude "&lt;&lt;endl;
cin&gt;&gt;incAttitude;
h.attitude+=incAttitude;
cout&lt;&lt;"the attitude of the board after the increase : "&lt;&lt;h.attitude&lt;&lt;endl;
}

Board &amp;Board::print(){

    cout&lt;&lt;"the length of the boarad : "&lt;&lt;length&lt;&lt;endl;
    cout&lt;&lt;"the width of the board : "&lt;&lt;width&lt;&lt;endl;
    cout&lt;&lt;"the height of the board : "&lt;&lt;attitude&lt;&lt;endl;
    cout&lt;&lt;"the location of the board : "&lt;&lt;location&lt;&lt;endl;
    cout&lt;&lt;"the surface of the board : "&lt;&lt;surface()&lt;&lt;endl;
    return *this;

}

int main(){
    Board hh;
    Board *boardptr;
int count,len,wid;
double att;
char locat[30];


cout&lt;&lt;"how many boards do you need to create ? "&lt;&lt;endl;
cin&gt;&gt;count;
boardptr = new Board[count];
assert(boardptr!=0);



for (int i=0; i&lt;count; i++){
 cout &lt;&lt; "Enter the length: ";
 cin &gt;&gt;len;
 cout &lt;&lt; "Enter the width: ";
 cin &gt;&gt; wid;
 cout &lt;&lt; "Enter the attitude: ";
 cin &gt;&gt; att;
  incAttitude(hh);
 cout&lt;&lt;"Enter the location: ";
 cin &gt;&gt;locat;
 boardptr[i].setBoard(len,wid,att,locat);
 cout&lt;&lt;"------------------------------------------"&lt;&lt;endl;

  if (strcmp("NewYork",locat) == 0) 
  {
     boardptr[i].setBoard(len,wid,att,locat).print();
  }

}


delete [] boardptr;

system("pause");
return 0;
}
</code></pre>
