A subject or object is not always a single word. A complete phrase may fill that role. First find the verb; then ask who performed the action and what received it. Keep every word belonging to that phrase together.
Sentence
Compound subject
Compound object
فَرِحَ أَخُو حَامِدٍ
أَخُو حَامِدٍ
—
ضَرَبَ زَيْدٌ أَخَا حَامِدٍ
—
أَخَا حَامِدٍ
قَرَأَ إِمَامُ الْمَسْجِدِ خُطْبَةً طَوِيلَةً
إِمَامُ الْمَسْجِدِ
خُطْبَةً طَوِيلَةً