I am trying to make a chess game. I have made two header files and their cpp files : Pieces.h and ChessBoard.h. I have included Pieces.h in ChessBoard.h and it's compiling fine. But I want to have a method in Pieces that requires ChessBoard as a parameter. So when I try to include ChessBoard.h in Pieces.h I get all weird errors. Can someone please guide me how to include ChessBoard.h in Pieces.h ?
Pieces.h:
#ifndef PIECES_H
#define PIECES_H
#include <string>
#include "ChessBoard.h"
using namespace std;
class Pieces{
protected:
    bool IsWhite;
    string name;
public:
    Pieces();
    ~Pieces();
    // needs to be overwritten by every sub-class
    virtual bool isValidMove(string initial,string final, ChessBoard& chessBoard) = 0;
    bool isWhite();
    void setIsWhite(bool IsWhite);  
    string getName();   
};
#endif
ChessBoard.h :
#ifndef CHESSBOARD_H
#define CHESSBOARD_H
#include "Pieces.h"
#include <map>
#include <string.h>
class ChessBoard
  {
        // board is a pointer to a 2 dimensional array representing board.
        // board[rank][file]
        // file : 0 b 7 (a b h) 
        std::map<std::string,Pieces*> board;
        std::map<std::string,Pieces*>::iterator boardIterator;
  public:
    ChessBoard();
    ~ChessBoard();
    void resetBoard();
    void submitMove(const char* fromSquare, const char* toSquare);
    Pieces *getPiece(string fromSquare);
    void checkValidColor(Pieces* tempPiece); // to check if the right player is making the move
};
#endif
errors:
ChessBoard.h:26: error: ‘Pieces’ was not declared in this scope
ChessBoard.h:26: error: template argument 2 is invalid
ChessBoard.h:26: error: template argument 4 is invalid
ChessBoard.h:27: error: expected ‘;’ before ‘boardIterator’
ChessBoard.h:54: error: ISO C++ forbids declaration of ‘Pieces’ with no type
ChessBoard.h:54: error: expected ‘;’ before ‘*’ token
ChessBoard.h:55: error: ‘Pieces’ has not been declared
 
     
     
    