Brazil international Kaka has failed to produce his best form at Real since joining the La Liga title holders in June 2009.

The 30-year-old has been heavily linked with a move back to Milan and Allegri, speaking after his team's 5-1 friendly defeat to Real on Wednesday, did not dismiss the possibility out of hand.

"For us, the transfer market is open until August 31 so let's see," he said.

"But we didn't just discover how good Kaka was from tonight. We already knew about his talent."

Milan's heavy defeat to Real is another blow to the team's morale during an off-season in which they lost star players Zlatan Ibrahimovic and Thiago Silva to Paris Saint-Germain.

Allegri acknowledged the significant gulf in quality between his squad and Real's, but insisted Milan still have enough quality to challenge for the Serie A title.

"There is a big gap between us and Real Madrid at the moment," he said.

"We played a strong first half, but we suffered during the second. We let them play with freedom during the second 45 minutes, they hit us on the counter attack and scored three easy goals.

"We are still one of the favourites for Serie A. Tonight, we played with a lot of players that have less experience on the international stage.

"So when you play against a star team like Real Madrid with so many world class players, it's very difficult in such occasions to find a way to score and to actually play well against them."

"We are going to analyse the game. We weren't a phenomenal team before, and we are not the worst team in the world either.

"Basically, we need to find the confidence within ourselves and face up to this defeat, because every defeat makes us stronger. Hopefully, it is a one-off defeat and we are going to try to improve and come back strongly from this."