Theoretical study of charge transfer in graphite intercalation compounds