Replace the cout usage by ostream