Q:

Can a friend class create objects from its friend classes in C++?

These are the code inside my two C++ header files where I declare two classes, one is friend of the other:
==>The first class creates a hash table and fills it with words from a given file.
#include "remove_duplicates.h"
class Hash_class{

protected:
    list<string> *hashTable;
    string input_file;
    string output_file;
    int input_file_size;
    friend class remove_duplicates;
    //void file_size();

public:

    /*load the words in the hash Table;
    by calculating the hash Code of each string*/
    Hash_class(string input_file,string output_file="output_file.txt");

    ~Hash_class(){
        fclose(input_file);
        fclose(ouput_file);
    }

    int hashCode( const string input_word);

    void loadInHash();

    void write_in_output();

    int get_input_file_size(){
        return input_file_size;
    }

    string get_input_file(){
        return input_file;
    }

    string get_output_file(){
        return output_file;
    }
};

In the second class I wanted to create an object from the first class and act on it, by first filling the hash table inside the object created then removing all the words that are concidered duplicates (if the Levenshtein distance is close to a certain proportion).
#include "Hash_class.h"
class remove_duplicates{
protected:
    Hash_class hash_object;
public:

    remove_duplicates(Hash_class & hash_object);

    int Levenshtein_distance(string s1,string s2);

    void set_purge();

};

The problem is when I compile the code I get the error: ([Error] 'Hash_class' does not name a type)
If is it possible can you please tell me how or some sources where I can learn about it. If it's not possible then some hints will be a great thing thanks.
("I use GCC 4.3.2")

A:

This looks like a circular include. 

"Hash_class.h" includes "remove_duplicates.h"
"remove_duplicates.h" includes "Hash_class.h"

To fix it, remove this line from "Hash_class.h":
#include "remove_duplicates.h"

That should work because the line
friend class remove_duplicates;

requires no information about how class remove_duplicates is implemented.
EDIT: To avoid further errors, wrap both header files in include guards.

