Shaykh Saalih al Fawzaan, may Allah preserve him, was asked:
Is it permissible to attend the funeral of a Kaafir if there is a benefit in it. For example, if a person didn’t attend the funeral of his relatives whom are Kuffaar they would get angry at him?
That is not permissible. It is not permissible for a Muslim that he attends the funeral of a Kaafir because this is a form of Muwaalah (showing love and allegiance to him) except in a scenario where the disbeliever has no one else to bury him. [In that case] then he is to buried as the Prophet, alaihi as salaatu wa as salaam, commanded Ali, may Allah be pleased with him, to bury Abaa Taalib. So if the Kaafir has no one else to bury him then the Muslim buries him.”
This statement of the Shaykh is available on his official website.
~ Abu Fajr AbdulFattaah bin Uthman