I want to out put like below:
The Stack & the Class Template (in-lab portion)
test nodes: 101(-> / ) 212(-> / )
test next:  101(->212) 212(-> / )
But my out put will be like below:
The Stack & the Class Template (in-lab portion)
test nodes: 101 (-> / )  212 (-> / ) 
test next:  101 (->212 (-> / ) )  212 (-> / )
My header IntNode is like below:
class IntNode {
public:
    IntNode( int new_value );
    int      get_data( ) const;
    void     set_next( IntNode* new_next );
    IntNode* get_next( ) const;
    void     debug_write( ostream& outfile ) const;
private:
    int      payload;
    IntNode* next = nullptr;
};
ostream& operator<<( ostream& outfile, const IntNode& node );
The implementation of write function is below:
void IntNode::debug_write( ostream& outfile ) const{
        outfile << payload;
        if(next == nullptr)
            outfile << "(-> / ) ";  
        else
            outfile << "(->" << *next << ") ";
}
ostream& operator<<( ostream& outfile, const IntNode& node ){
    node.debug_write(outfile);
    return outfile;
}
The main function is like below:
int main(){
    cout << "The Stack & the Class Template (in-lab portion)\n";
    IntNode int_item_1( 101 );
    IntNode int_item_2( 212 );
    cout << "test nodes: " << int_item_1 << ' ' << int_item_2 << "\n";
    int_item_1.set_next( &int_item_2 );
    cout << "test next:  " << int_item_1 << ' ' << int_item_2 << "\n\n";
    return 0;
}
 
    