Question: I'm making a board game using C++ that involves multiple classes. When I include the header file of `piece.h` in `board.h`, all of piece's members are being recognized by the board. But when I simultaneously link `board.h` to `piece.h`, the members of board are not being recognized.
Here are how I am linking them:

-In `piece.h`

```
    #ifndef PIECE_H_
    #define PIECE_H_
    #include <iostream>
    #include "board.h"

```

-In `board.h`

```
    #ifndef BOARD_H_
    #define BOARD_H_
    #include<iostream>
    #include "piece.h"

```

I declared multiple piece members of board and piece type parameters of board functions, and they work fine. Yet declaring a void function within piece that takes board parameters, as such:

```
    void horizontal         (Board b);
    void vertical           (Board b);
    void diagonal           (Board b);

```

results in an error saying "Board has not been declared"

Answer: 
Including a file basically tells the preprocessor "copy that file's content here". If both headers refer to each other, you have a circular reference, which cannot compile. The compiler has to know at least a bit about the data types being used.  

This can be done by using **forward declarations**:

*Board.h*

```
class Piece; // Forward declaration without defining the type

class Board
{
    // Board can makes use of Piece, only as long
    // as it does not need to know too much about it.
    // References and pointers are ok.
    Piece* foo();
    void bar(Piece&);
};

```

*Piece.h*

```
#include "Board.h"

class Piece
{
    // Actual definition of class.
    // At this point Board is fully defined and Piece can make use of it.
    Board* foo() { /*...*/ }
    void bar(Board& x) { /*...*/ }

    // Not only references are possible:
    Board baz(const Board x) { /*...*/ } 
};

```

*Board.cpp*

```
#include "Board.h"
#include "Piece.h"

// Implementation of Board's functions can go after Piece's definition:
Piece* Board::foo() { /*...*/ }
void Board::bar(Piece& x) { /*...*/ }

```
Try putting this at the top of "piece.h"

```
 class Board;

```