Technically you can't, because it's not an object.
The boring, but factual answer to this question is that the improvised weapon rules on pages 147-148 of the Player's Handbook only apply to objects, not creatures:
An improvised weapon includes any object you can wield in one or two hands, such as broken glass, a table leg, a frying pan, or a dead goblin.
"Object" isn't strictly defined in the D&D rules, so it has the everyday English-language meaning of that word, meaning an inanimate non-living item.
You could argue that a creature is a subtype of object, but that would lead to bizarre interpretations, such as that all creatures are immune to poison and psychic damage. Player's Handbook p.185, "Interacting with Objects", makes it clear that creatures and objects are different things in D&D:
Objects are immune to poison and psychic damage, but otherwise they can be affected by physical and magical attacks much like creatures can. [...] Objects always fail Strength and Dexterity saving throws, and they are immune to effects that require other saves.
However, if a halfling were wielded as a melee weapon, it would merely deal 1d4 damage.
Suppose the DM likes the idea of using a live halfling as an improvised weapon, and allows it anyway.
Technically, according to Player's Handbook p.147-148, any improvised weapon deals 1d4 damage, unless it resembles an actual weapon, in which case it deals damage as that weapon.
There is no weapon listed in the Player's Handbook which is akin to a halfling. Nor can I find one at D&D Beyond's list of weapons or things used to deal damage.
The result is that, rules-as-written, swinging a fellow player character as an improvised weapon only deals 1d4 damage. He or she is just not designed for use as an effective weapon.
There is no rule in the books which says your "weapon" also receives damage for being used as a weapon. However, the rules do seem to assume that your weapon is an object, which does not appear to be the case here. Regardless, there's no rule-as-written saying the halfling being wielded takes damage, though the DM always has the option to rule otherwise.
Grappling rules may also be used here. These apply when you want to grab a creature (Player's Handbook p.195). The halfling's speed would be reduced to 0, and when you move, you can carry it with you. You have to win a Strength (Athletics) check opposed by the halflings's Strength (Athletics) or Dexterity (Acrobatics) check to pick up, because D&D 5e has no rule to allow allies to auto-fail saves or checks when it suits them. (The DM can, of course, adjudicate that picking up a willing ally automatically succeeds, but there's no core rule for that specific action.)
Regardless, you're now successfully carrying a halfling. This is legitimate. According to Player's Handbook p.191, "Moving Around Other Creatures", you can move through a nonhostile creature's space. You can't willingly end your move in in an ally's space, but that doesn't affect the halfling, since he's not being wielded on his own move, but on the barbarian's turn.
However, the barbarian can't end his own movement in the halfling's space. He can keep his grapple indefinitely until something breaks it, but he's got to put the halfling somewhere between turns: in an adjacent square, or perhaps held above his head, if we consider three-dimensional space.
Also, the halfling can potentially use the Help action (Player's Handbook p.192) to assist you:
Alternatively, you can aid a friendly creature in attacking a creature within 5 feet of you. You feint, distract the target, or in some other way team up to make your ally's attack more effective. If your ally attacks the target before your next turn, the first attack roll is made with advantage.