The first thing I can say to you is be open and honest with all parties, it will make the whole process that much easier for everyone involved. It doesn't mean you have to tell them absolutely everything, for example I wouldn't tell company A that you would prefer to work for company B, but I would tell company B you have an offer on the table from company A who are expecting an answer the following day.
If company B can give you an answer by Friday then great, you have the ideal situation. As @GarrisonNeely commented use the offer from company A at your interview to try and get the process speeded up. Assuming they also give you an offer you can then pick and choose at your leisure. But they may not be able to give you an offer in such a short time frame. They may have other candidates to interview at a later time or meetings to be held to consider candidates. In that case at best you may get an indication of when to expect an answer.
If that is the situation come Friday you're in a difficult situation. If you ask for more time from company A you're pretty much telling them you're holding out for another job. It's at that point you would need to make a decision and either hold out for company B, in which case you can ask for more time from company A (just don't expect a favourable response) and then if it goes south put your hopes in company B.
Or you can accept the job with company A and not let the hope of company B lead you on. You have a firm offer and that's better than a possible offer from a company you'd prefer to work for.