Compiler issues an error that the identifier "func" is undefined:

I don't know why this error occurs because I link the header file, with the declaration of this function. I use Visual Studio 2017 Community.
My code:
foo.h
#pragma once
class Foo {
    friend void func();
};
foo.cpp
#include "foo.h"
void func()
{
}
bar.h
#pragma once
class Bar {
    void baz();
};
bar.cpp
#include "bar.h"
#include "foo.h"
void Bar::baz()
{
    func(); // indentifier "func" is undefined
}
 
    