This fails (the code computes the quotient group directly from the definition):
with(GroupTheory):
Qgr := (sgr, gr) -> CustomGroup(LeftCosets(sgr, gr),
`.` = ((a, b) -> LeftCoset(Representative(a) . Representative(b), sgr)),
`/` = ((a) -> LeftCoset(Representative(a)^(-1), sgr)),
`=` = ((a, b) -> Elements(a) = Elements(b)));
gr := QuaternionGroup();
Generators(gr);
[(1, 2, 3, 4)(5, 6, 8, 7), (1, 5, 3, 8)(2, 7, 4, 6)]
qgr := Qgr(Subgroup({Generators(gr)[1]^2}, gr), gr);
qgr := ` < a custom group with 4 generators > `
AreIsomorphic(qgr, DirectProduct(CyclicGroup(2), CyclicGroup(2)));
Error, (in =) invalid keyword expression
If I rename the parameters in the definition of Qgr, e.g., change the last line to
`=` = ((aa, bb) -> Elements(aa) = Elements(bb))
then everything works, AreIsomorphic gives true.