When a person dies, there is no biblical necessity for the funeral to be held in a church, or a funeral parlor, with a pastor officiating. The reason we have funerals in churches and funeral parlors is because of tradition, particularly here in western cultures. There are other areas of the world where funerals take radically different forms, such as a procession in a street, cremation, burial at sea, burials in caves, etc. Also, those who preside over funerals vary from shamans, priests, or friends of the deceased.
Furthermore, it is not a church and a pastor that makes a funeral proper. There is no special power the Christian church or pastor might have in relation to a person who has died. Again, it is simply the custom of our land, due to the heavy Christian influence of the past, that we have funerals where pastors speak of the things of God, share the word of God, and point people to redemption in Christ. After all, the death of a friend is always a sobering event, and such times can be used to preach the gospel.